import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from "rxjs";

@Injectable({
  providedIn: 'root'
})
export class SellDeliveryActivitiesService {

  // 字典查询
  dictUrl = '/dict/detail';
  // 查询数据线活动列表
  queryActivityListUrl = '/activityGivingUserRecord/list';

  // 审核
  examineUrl = '/activityGivingUserRecord/audit';
  // 导出
  exportActivityUrl = '/activityGivingUserRecord/collectionExcel';

  constructor(public httpClient: HttpClient) { }

  /**
   * 查询数据线列表
   * @param params 
   * @returns 
   */
  getActivityList(params: any) {
    return this.httpClient.post(this.queryActivityListUrl, params).toPromise();
  }

  /**
   * 审核
   * @param params 
   * @returns 
   */
  activityExamine(params: any) {
    return this.httpClient.post(this.examineUrl, params).toPromise();
  }

  /**
   * 导出
   * @returns 
   */
  exportActivity() {
    return this.httpClient.get(this.exportActivityUrl).toPromise();
  }

  /**
   * 查询字典子类列表
   * @param parentKey 
   * @returns 
   */
  getDictList(parentKey: any) {
    let params: any = {
      parentKey: parentKey,
      pageNum: 0,
      pageSize: 0
    }
    return this.httpClient.get(this.dictUrl, { params }).toPromise();
  }
}



